package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"houses_srv/housesclient"
)

type ServiceContext struct {
	Config              config.Config
	HousesSrv           housesclient.Houses
	UserAgentMiddleware rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:              c,
		HousesSrv:           housesclient.NewHouses(zrpc.MustNewClient(c.HousesSrv)),
		UserAgentMiddleware: middleware.NewUserAgentMiddleware().Handle,
	}
}
